/**
 * 
 */
package org.gigi.core.web;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
 * 基本的Reponse返回值
 * 
 * @author Eugene Wang 2011-5-26
 * @see
 */
@JsonIgnoreProperties("mixInAnnotations")
public class BasicResponse implements JacksonMixIns, Serializable {
	private static final long serialVersionUID = 7488739952580215876L;
	private Boolean success;
	private String msg;
	private Map<Class<?>, Class<?>> mixInAnnotations;

	/**
	 * 默认构造函数
	 */
	public BasicResponse() {
		this(true);
	}

	/**
	 * 构造函数
	 * 
	 * @param success
	 */
	public BasicResponse(Boolean success) {
		this(success, null);
	}

	/**
	 * 构造函数
	 * 
	 * @param msg
	 */
	public BasicResponse(String msg) {
		this(true, msg);
	}

	/**
	 * 构造函数
	 * 
	 * @param success
	 * @param msg
	 */
	public BasicResponse(Boolean success, String msg) {
		super();
		this.success = success;
		this.msg = msg;
	}

	public Boolean getSuccess() {
		return success;
	}

	public void setSuccess(Boolean success) {
		this.success = success;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Map<Class<?>, Class<?>> getMixInAnnotations() {
		return mixInAnnotations;
	}

	public void setMixInAnnotations(Map<Class<?>, Class<?>> mixInAnnotations) {
		this.mixInAnnotations = mixInAnnotations;
	}

	public void addMixInAnnotations(Class<?> target, Class<?> mixinSource) {
		if (mixInAnnotations == null) {
			mixInAnnotations = new HashMap<Class<?>, Class<?>>();
		}
		mixInAnnotations.put(target, mixinSource);
	}
}
